//
//  ViewController.m
//  UI01_UIView_HomeWork
//
//  Created by Bodi on 16/6/3.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
#if 0
    [self addView];
#endif
    
    
    
#if 1
    [self addViewTwo];
#endif
    
#if 0
    
    [self addViewThree];
#endif
    
    
    
    
    
    
    
    
    
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
-(void)addView{
    UIView *view1 = [[UIView alloc]initWithFrame:CGRectMake(100, 100, 200, 30)];
    view1.backgroundColor = [UIColor redColor];
    [self.view addSubview:view1];
    [view1 release];
    UIView *view2 = [[UIView alloc]initWithFrame:CGRectMake(100, 150, 200, 30)];
    view2.backgroundColor = [UIColor yellowColor];
    [self.view addSubview:view2];
    [view2 release];
    UIView *view3 = [[UIView alloc]initWithFrame:CGRectMake(100, 210, 200, 30)];
    view3.backgroundColor = [UIColor greenColor];
    [self.view addSubview:view3];
    [view3 release];
    UIView *view4 = [[UIView alloc]initWithFrame:CGRectMake(100, 270, 200, 30)];
    view4.backgroundColor = [UIColor blueColor];
    [self.view addSubview:view4];
    [view4 release];
    UIView *view5 = [[UIView alloc]initWithFrame:CGRectMake(100, 330, 200, 30)];
    view5.backgroundColor = [UIColor grayColor];
    [self.view addSubview:view5];
    [view5 release];
    
    
    
    
}

-(void)addViewTwo{
    UIView *view = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 414, 736)];
    view.backgroundColor = [UIColor grayColor];
    view.alpha = 0.9;
    [self.view addSubview:view];
    [view release];
    
    UIView *view1 = [[UIView alloc]initWithFrame:CGRectMake(50, 90, 110, 50)];
    view1.backgroundColor = [UIColor cyanColor];
    [self.view addSubview:view1];
    [view1 release];
    
    UIView *view2 = [[UIView alloc]initWithFrame:CGRectMake(210, 90, 160, 50)];
    view2.backgroundColor = [UIColor cyanColor];
    [self.view addSubview:view2];
    [view2 release];
    
    UIView *view3 = [[UIView alloc]initWithFrame:CGRectMake(50, 170, 110, 50)];
    view3.backgroundColor = [UIColor cyanColor];
    [self.view addSubview:view3];
    [view3 release];
    
    UIView *view4 = [[UIView alloc]initWithFrame:CGRectMake(210, 170, 160, 50)];
    view4.backgroundColor = [UIColor cyanColor];
    [self.view addSubview:view4];
    [view4 release];
    
    UIView *view5 = [[UIView alloc]initWithFrame:CGRectMake(90, 260, 82, 40)];
    view5.backgroundColor = [UIColor cyanColor];
    [self.view addSubview:view5];
    [view5 release];
    
    UIView *view6 = [[UIView alloc]initWithFrame:CGRectMake(270, 260, 82, 40)];
    view6.backgroundColor = [UIColor cyanColor];
    [self.view addSubview:view6];
    [view6 release];
    
    






}


-(void)addViewThree{
    
    

    for (int i = 0; i <= 7; i++) {
        for (int j = 0; j <= 4; j++) {
            UIView *view = [[UIView alloc]initWithFrame:CGRectMake((414 / 5) * j,(736 / 8) * i,  414 / 5, 736 / 8)];
            
            view.backgroundColor = [UIColor colorWithRed:arc4random_uniform(255)/255.0 green:arc4random_uniform(255)/255.0 blue:arc4random_uniform(255)/255.0 alpha:1];
            [self.view addSubview:view];
            [view release];
            
            
            
        }
    }






}




@end
